package com.cx.base.day12_framework.collection;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.*;

/**
 * @Author: robert.song
 * @Date: Created in 2021/8/11
 */
@Slf4j(topic = "Iterator_")
public class Iterator_ {
    public static void main(String[] args) {
//        Collection collection = new ArrayList();
//        collection.add(new Book("三国志",new Date(),30.05f));
//        collection.add(new Book("红楼梦",new Date(),31.05f));
//        collection.add(new Book("七宗罪",new Date(),32.05f));
////        两种遍历
////        1、Iterator
//        Iterator<Book> iterator = collection.iterator();
//        while (iterator.hasNext()){
//            Book book = iterator.next();
//            log.info(book.toString());
//        }
////        2、forEach,快捷键：输入I 回车。
////        翻遍译发现调用了集合的迭代器
//        for(Object book:collection){
//            log.info(book.toString());
//        }

//        ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap(10);
        HashMap hashMap = new HashMap(32);
//         hashMap.put("1","1");
//        hashMap.put("2","2");

    }
}

@Data
@AllArgsConstructor
@NoArgsConstructor
class Book {
    private String name;
    private Date date;
    private float price;
}